
import time


def simple_middleware(get_response):
    # One-time configuration and initialization.

    def middleware(request):
        # Code to be executed for each request before
        # the view (and later middleware) are called.
        starttime = time.time()
        response = get_response(request)
        code = time.time()-starttime
        print(f"本次请求使用了{code}秒")
        # Code to be executed for each request/response after
        # the view is called.

        return response

    return middleware